lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Sorting algorithms.md (897B)


      1 +++
      2 title = 'Sorting algorithms'
      3 +++
      4 # Sorting algorithms
      5 Sorting: arranging the elements in a list/collection in increasing/decreasing order of some property; elements are homogeneous
      6 
      7 important to:
      8 
      9 - optimise the use of other algorithms
     10 - make searching easier (you can use binary search)
     11 - normalise and standardise data
     12 - produce a readable output
     13 
     14 Classification based on:
     15 
     16 - computational complexity (big O)
     17 - memory usage
     18 - recursion
     19 - stability
     20     - a sorting algorithm is stable if: relative order of elements with equal values in input is maintained in the output
     21     - example: sorting list of words by first letter, if two words “straw” and “spoon” stay in the same order, it is stable (we only care about the first letter)
     22     - stability is not an issue with array of integers
     23 
     24 Types:
     25 
     26 - [Bubble sort](./bubble-sort)
     27 - [Quicksort](./quicksort)
     28 - [Merge sort](./merge-sort)